﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;

/// <summary>
/// 相机管理
/// </summary>
public class CameraManager : MonoBehaviour
{
    public static CameraManager Instance;
    [Header("主相机")]
    public Camera mainCamera;
    [Header("相机位置")]
    public CameraPosition cameraPos;

    private void Awake()
    {
        Instance = this;
    }

    // 切换相机位置
    public void ChangeCameraPos(Transform pos, float duration)
    {
        if (pos == cameraPos.originalPos || pos == cameraPos.passengerPos_0)
            mainCamera.fieldOfView = 60;
        else
        {
            mainCamera.fieldOfView = 70;
            PassengerManager.Instance.PassengerInit();
        }
        mainCamera.transform.DOLocalMove(pos.position, duration).SetEase(Ease.OutQuad);
        mainCamera.transform.DORotateQuaternion(pos.rotation, duration).SetEase(Ease.OutQuad);
    }

}

/// <summary>
/// 相机位置
/// </summary>
[Serializable]
public class CameraPosition
{
    //初始位置
    public Transform originalPos;
    // 旅客安检位置
    public Transform passengerPos_0;
    public Transform passengerPos_1;
}

